package com.lyfx.ly.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import com.lyfx.common.valid.AddGroup;
import com.lyfx.common.valid.EditGroup;
import com.lyfx.common.valid.EditStatusGroup;
import com.lyfx.common.valid.ListValue;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * **课程表**
 * 
 * @author lsy
 * @email lsy@gmail.com
 * @date 2020-07-05 18:03:59
 */
@Data
@TableName("ly_class_course")
public class ClassCourseEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 主键，课程id
	 */
	@Null(message = "新增不能指定id",groups = {AddGroup.class})
	@NotNull(message = "修改必须指定id",groups = {EditGroup.class})
	@TableId
	private Long courseId;
	/**
	 * 课程名字
	 */
	@NotBlank(message = "课程名必须提交",groups = {AddGroup.class,EditGroup.class})
	private String name;
	/**
	 * 课程图片地址
	 */
	@NotBlank(groups = {AddGroup.class})
	@URL(message = "图片必须是合法的url地址",groups = {AddGroup.class,EditGroup.class})
	private String logo;
	/**
	 * 课程介绍
	 */
	private String descript;
	/**
	 * 排序
	 */
	@NotNull(groups = {AddGroup.class})
	@Min(value = 0,message = "排序必须大于等于0",groups = {AddGroup.class,EditGroup.class})
	private Integer sort;
	/**
	 * 检索首字母
	 */
	@NotEmpty(groups = {AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须是一个字符",groups = {AddGroup.class,EditGroup.class})
	private String firstLetter;
	/**
	 * 课程热度
	 */
	@NotNull(groups = {AddGroup.class})
	@Min(value = 0,message = "热度必须大于等于0",groups = {AddGroup.class,EditGroup.class})
	private Integer courseHeat;
	/**
	 * 状态  0：删除   1：正常
	 */
	@TableField("is_status")
	@NotNull(groups = {AddGroup.class,EditGroup.class})
	@ListValue(vals = {0,1},groups = {AddGroup.class, EditStatusGroup.class})
	private Integer showStatus;
	/**
	 * 创建时间
	 */
	@TableField(fill = FieldFill.INSERT)
	private Date gmtCreate;
	/**
	 * 更新时间
	 */
	@TableField(fill = FieldFill.INSERT_UPDATE)
	private Date gmtModified;

}
